package com.guigu.www.tangyingmeng.controller;

import com.guigu.www.pojo.*;
import com.guigu.www.tangyingmeng.service.TymBespeakService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@RestController
@RequestMapping("/bespeak")
public class TymBespeakController {

    @Autowired
    private TymBespeakService service;

    //分页查询预约列表
    @PostMapping("/selbespeakall")
    public PageVo<Bespeak> selall(@RequestBody Map<String,String> map){
        PageVo<Bespeak> pageVo = service.selldespeakall(map);
        return pageVo;
    }

    //确认预约
    @GetMapping("/appointmentdetails/{besid}")
    public Bespeak appointmentdetails(@PathVariable("besid") Integer besid){
        Bespeak bespeak = service.appointmentdetails(besid);
        return bespeak;
    }

    @PostMapping("/selmeals")
    public List<BespeakSetMeal> setMeals(){
        List<BespeakSetMeal> setMeals = service.selbespeaksetmeal();
        return setMeals;
    }

    @PostMapping("/selmember")
    public List<Member> selMember(){
        List<Member> members = service.selmember();
        return members;
    }

    @PostMapping("/addbespeak")
    public Boolean addBespeak(@RequestBody Bespeak bespeak){
        Boolean addbespeak = service.addbespeak(bespeak);
        return addbespeak;
    }

    // 查询是否可以预约
    @PostMapping("/yanzhengTime")
    public SingleDayAppointment yanzhengTime(String besTime){
        return service.yanzhengTime(besTime);
    }
}
